/**
 * 
 */
package denaris.core;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.game.Sprite;

import denaris.core.controller.AbstractController;

/**
 * @author stkl23
 *
 */
public class Bullet extends AbstractParticle {

	public Bullet(AbstractController controller) {
		super(controller);
	}

	/* (non-Javadoc)
	 * @see denaris.core.AbstractParticle#paint(javax.microedition.lcdui.Graphics)
	 */
	public void paint(Graphics g) {
		controller.getSprite().paint(g);
	}

	/* (non-Javadoc)
	 * @see denaris.core.AbstractParticle#update()
	 */
	public void update() {
		if (!controller.advance()) {
			notifyOutOfScope();
		}
	}
	
	public boolean collidesWith(TiledMap map) {
		Sprite sprite = getController().getSprite();
		return sprite.collidesWith(map.getLayer(), false);
	}
}
